//
//  Founction.h
//  s.
//
//  Created by pro on 2021/1/15.
//  Copyright © 2021 hailuo. All rights reserved.
//

#ifndef Founction_h
#define Founction_h

#define kUSER [U_UserDefaults fetchUserModel]
#define UserToken  [U_UserDefaults fetchToken]

#define StoreSetting GlobalManager.shareInstance.settings

#define LocalizedString(key) [XJTool localizedStringForKey:key Table:@"InfoPlist"]
#define SWString(key)   [XJTool localizedStringForKey:key Table:@"Localizable"]

/*---Color---*/
#define ColorBlack     [UIColor blackColor]
#define ColorWhite     [UIColor whiteColor]
#define ColorClear     [[UIColor whiteColor] colorWithAlphaComponent:0]
#define ColorBlue      [UIColor getColorWithHex:@"#494999"]
/// 十六进制颜色
#define COLOR_16F_A(hexValue, alphaValue) [UIColor colorWithRed:((float)((hexValue & 0xFF0000) >> 16))/255.0 green:((float)((hexValue & 0xFF00) >> 8))/255.0 blue:((float)(hexValue & 0xFF))/255.0 alpha:alphaValue]
//防止block循环引用
#define WeakSelf(x)  __weak typeof(x) weakSelf = self;

// 主窗口 （keyWindow）
#define KeyWindow         [XJTool searchKeyWindow]

#define ShareConfigDic [JYConfigDic shareConfigDic]

#define DateFormatter     @"yyyy-MM-dd"
#define DateFormatterHour @"yyyy-MM-dd HH:mm"
#define DateFormatterSecond @"yyyy-MM-dd HH:mm:ss"

#define DateFormatterMD @"MM月dd号"
#define DateFormatterSecond2 @"yyyy/MM/dd HH:mm:ss"
#define DateFormatterSecond4 @"yyyy/MM/dd HH:mm"
/*---设备尺寸和比例---*/
#define UI_Screen_Height [UIScreen mainScreen].bounds.size.height
#define UI_Screen_Width  [UIScreen mainScreen].bounds.size.width
#define UI_Scale_Width   UI_Screen_Width/375.0
#define UI_Scale_Height  UI_Screen_Height/667.0

//判断是否是ipad
#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
//判断iPhone X
#define IS_IPHONE_X ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPHoneXr
#define IS_IPHONE_Xr ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs
#define IS_IPHONE_Xs ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs Max
#define IS_IPHONE_Xs_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)

//iPhoneX系列
#define Height_StatusBar ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 44.0 : 20.0)
#define Height_NavBar ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 88.0 : 64.0)
#define Height_TabBar ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 83.0 : 49.0)

// X与普通机型的差距
#define HeightDiffer_StatusBar ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 22 : 0)
#define HeightDiffer_NavBar ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 24 : 0)
#define HeightDiffer_TabBar ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 34 : 0)

#endif /* Founction_h */
